package cn.yunhe.model;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/*hibernate注解s213*/
@Entity(name = "Street1")
@Table(name = "street")
/*@Table(name = "streets")*/
public class Street implements Serializable {
    private Integer sid;
    private String sname;
    private District district;

    private Set<House>houseSet=new HashSet<>();

    public Street() {
    }

    public Street(String sname) {
        this.sname = sname;
    }


    public Street(String sname, District district) {
        this.sname = sname;
        this.district = district;
    }

    public Street(Integer sid, String sname) {
        this.sid = sid;
        this.sname = sname;
    }

    @Id
    @GeneratedValue
    @Column(name = "sid")
    public Integer getSid() {
        return sid;
    }

    public void setSid(Integer sid) {
        this.sid = sid;
    }

    @Column(name = "sname")
    public String getSname() {
        return sname;
    }

    public void setSname(String sname) {
        this.sname = sname;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "sdid")
    public District getDistrict() {
        return district;
    }

    public void setDistrict(District district) {
        this.district = district;
    }

    @OneToMany(fetch = FetchType.LAZY)
    @JoinColumn(name = "hsid")
    public Set<House> getHouseSet() {
        return houseSet;
    }

    public void setHouseSet(Set<House> houseSet) {
        this.houseSet = houseSet;
    }
}
